home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-01-22 | 2.8 KB | 93 lines | [TEXT/CWIE] |
- // ===========================================================================
- // CExeption.cp ©1996 Sunbay Development Group. All rights reserved.
- // ===========================================================================
- // Jul 17,1996
-
- #include <Memory.h>
- #include <Menus.h>
- #include "CExeption.h"
-
- Str255 CExeption::mDescriptor;
-
- // ---------------------------------------------------------------------------
- // Constructor
- // ---------------------------------------------------------------------------
-
- CExeption::CExeption(void) {
- mType = 0;
- mCode = 0;
- mDescriptor[0] = 0;
- }
-
- // ---------------------------------------------------------------------------
- // Destructor
- // ---------------------------------------------------------------------------
-
- CExeption::~CExeption(void) {
- }
-
- // ---------------------------------------------------------------------------
- // Process exeption
- // ---------------------------------------------------------------------------
-
- Boolean CExeption::Process(void) {
- Boolean expProcessed = false;
- return expProcessed;
- }
-
- // ---------------------------------------------------------------------------
- // Create alert
- // ---------------------------------------------------------------------------
- // The dialog box has to have one button that generate message cmd_Close (4)
-
- void CExeption::Alert(OSType inResID) {
- LDialogBox * dlog;
- LCommander * superCommander;
- LEventDispatcher * evtDispetcher;
- EventRecord macEvent;
- Boolean gotEvent;
- LMenuBar * theMenuBar;
- LMenu * theMenu;
-
- evtDispetcher = LEventDispatcher::GetCurrentEventDispatcher();
- superCommander = LCommander::GetTopCommander();
- LCommander::SetDefaultCommander(superCommander);
- dlog = (LDialogBox *) UReanimator::ReadObjects('PPob', inResID);
- if(dlog != nil) {
- dlog->FinishCreate();
- CastomAlert(dlog);
- UDesktop::Deactivate();
- // Disable menu bar
- theMenuBar = LMenuBar::GetCurrentMenuBar();
- if(theMenuBar != nil) {
- theMenu = nil;
- while(theMenuBar->FindNextMenu(theMenu)) {
- ::DisableItem(theMenu->GetMacMenuH(), 0);
- }
- }
- dlog->Show();
- // Event loop of the dialog
- do {
- gotEvent = ::WaitNextEvent(everyEvent, &macEvent, 6, dlog->GetLocalUpdateRgn());
- if(evtDispetcher->ExecuteAttachments(msg_Event, &macEvent)) {
- if(gotEvent) evtDispetcher->DispatchEvent(macEvent);
- else evtDispetcher->UseIdleTime(macEvent);
- }
- // Repeaters get time after every event
- LPeriodical::DevoteTimeToRepeaters(macEvent);
- } while(UDesktop::FetchTopModal() == dlog);
- // Enable menu bar
- if(theMenuBar != nil) {
- theMenu = nil;
- while(theMenuBar->FindNextMenu(theMenu)) {
- ::EnableItem(theMenu->GetMacMenuH(), 0);
- }
- }
- // Update status of menu items
- if(dlog->IsOnDuty() && dlog->GetUpdateCommandStatus())
- evtDispetcher->UpdateMenus();
- UDesktop::Activate();
- }
- }
-
-